﻿namespace HuaWei
{
    using DevExpress.XtraBars;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraTreeList;
    using DevExpress.XtraTreeList.Columns;
    using DevExpress.XtraTreeList.Nodes;
    using HuaWei.CommClass;
    using HuaWei.DAI;
    using HuaWei.Windows.Forms;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    public class FrmDataXD : Form
    {
        [CompilerGenerated]
        private string _str;
        [CompilerGenerated]
        private string _str1;
        private Bar bar;
        private Bar bar1;
        private BarDockControl barDockControl;
        private BarDockControl barDockControl1;
        private BarDockControl barDockControl2;
        private BarDockControl barDockControl3;
        private BarLargeButtonItem barLargeButtonItem1;
        private BarLargeButtonItem barLargeButtonItem2;
        private BarManager barManager;
        private BindingSource bindingSource;
        private BindingSource bindingSource1;
        private TreeListColumn colMC;
        private DataSet dataSet = new DataSet();
        private GroupControl groupControl1;
        private IContainer icontainer = null;
        private ImageList imageList;
        private RepositoryItemImageComboBox repositoryItemImageComboBox2;
        private TreeList tlXMXX;

        public FrmDataXD()
        {
            this.InitializeComponent();
        }

        private void barLargeButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (this.tlXMXX.FocusedNode.HasChildren)
            {
                MsgBox.ShowWarning("请选择需要下达的项目信息!");
            }
            else
            {
                this.XMID = DHelp.GetObjId(this.bindingSource1);
                this.XMName = DHelp.GetObjValue(this.bindingSource1, "XMMC", false);
                base.Close();
            }
        }

        private void barLargeButtonItem2_ItemClick(object sender, ItemClickEventArgs e)
        {
            base.Close();
        }

        private void bindingSource1_PositionChanged(object sender, EventArgs e)
        {
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.icontainer != null))
            {
                this.icontainer.Dispose();
            }
            base.Dispose(disposing);
        }

        private void FrmDataXD_Load(object sender, EventArgs e)
        {
            this.method();
        }

        private void InitializeComponent()
        {
            this.icontainer = new Container();
            ComponentResourceManager resources = new ComponentResourceManager(typeof(FrmDataXD));
            this.barManager = new BarManager(this.icontainer);
            this.bar = new Bar();
            this.barLargeButtonItem1 = new BarLargeButtonItem();
            this.barLargeButtonItem2 = new BarLargeButtonItem();
            this.bar1 = new Bar();
            this.barDockControl = new BarDockControl();
            this.barDockControl1 = new BarDockControl();
            this.barDockControl2 = new BarDockControl();
            this.barDockControl3 = new BarDockControl();
            this.imageList = new ImageList(this.icontainer);
            this.bindingSource = new BindingSource(this.icontainer);
            this.groupControl1 = new GroupControl();
            this.tlXMXX = new TreeList();
            this.colMC = new TreeListColumn();
            this.bindingSource1 = new BindingSource(this.icontainer);
            this.repositoryItemImageComboBox2 = new RepositoryItemImageComboBox();
            this.barManager.BeginInit();
            ((ISupportInitialize) this.bindingSource).BeginInit();
            this.groupControl1.BeginInit();
            this.groupControl1.SuspendLayout();
            this.tlXMXX.BeginInit();
            ((ISupportInitialize) this.bindingSource1).BeginInit();
            this.repositoryItemImageComboBox2.BeginInit();
            base.SuspendLayout();
            this.barManager.Bars.AddRange(new Bar[] { this.bar, this.bar1 });
            this.barManager.DockControls.Add(this.barDockControl);
            this.barManager.DockControls.Add(this.barDockControl1);
            this.barManager.DockControls.Add(this.barDockControl2);
            this.barManager.DockControls.Add(this.barDockControl3);
            this.barManager.Form = this;
            this.barManager.Items.AddRange(new BarItem[] { this.barLargeButtonItem1, this.barLargeButtonItem2 });
            this.barManager.LargeImages = this.imageList;
            this.barManager.MainMenu = this.bar;
            this.barManager.MaxItemId = 2;
            this.barManager.StatusBar = this.bar1;
            this.bar.BarName = "Main menu";
            this.bar.DockCol = 0;
            this.bar.DockRow = 0;
            this.bar.DockStyle = BarDockStyle.Top;
            this.bar.LinksPersistInfo.AddRange(new LinkPersistInfo[] { new LinkPersistInfo(this.barLargeButtonItem1), new LinkPersistInfo(this.barLargeButtonItem2) });
            this.bar.OptionsBar.MultiLine = true;
            this.bar.OptionsBar.UseWholeRow = true;
            this.bar.Text = "Main menu";
            this.barLargeButtonItem1.Alignment = BarItemLinkAlignment.Right;
            this.barLargeButtonItem1.Caption = "下达";
            this.barLargeButtonItem1.Id = 0;
            this.barLargeButtonItem1.LargeImageIndex = 1;
            this.barLargeButtonItem1.Name = "barLargeButtonItem1";
            this.barLargeButtonItem1.ItemClick += new ItemClickEventHandler(this.barLargeButtonItem1_ItemClick);
            this.barLargeButtonItem2.Caption = "关闭";
            this.barLargeButtonItem2.Id = 1;
            this.barLargeButtonItem2.LargeImageIndex = 0;
            this.barLargeButtonItem2.Name = "barLargeButtonItem2";
            this.barLargeButtonItem2.ItemClick += new ItemClickEventHandler(this.barLargeButtonItem2_ItemClick);
            this.bar1.BarName = "Status bar";
            this.bar1.CanDockStyle = BarCanDockStyle.Bottom;
            this.bar1.DockCol = 0;
            this.bar1.DockRow = 0;
            this.bar1.DockStyle = BarDockStyle.Bottom;
            this.bar1.OptionsBar.AllowQuickCustomization = false;
            this.bar1.OptionsBar.DrawDragBorder = false;
            this.bar1.OptionsBar.UseWholeRow = true;
            this.bar1.Text = "Status bar";
            this.barDockControl.Dock = DockStyle.Top;
            this.barDockControl.Location = new Point(0, 0);
            this.barDockControl.Size = new Size(0xe1, 0x29);
            this.barDockControl1.Dock = DockStyle.Bottom;
            this.barDockControl1.Location = new Point(0, 310);
            this.barDockControl1.Size = new Size(0xe1, 0x16);
            this.barDockControl2.Dock = DockStyle.Left;
            this.barDockControl2.Location = new Point(0, 0x29);
            this.barDockControl2.Size = new Size(0, 0x10d);
            this.barDockControl3.Dock = DockStyle.Right;
            this.barDockControl3.Location = new Point(0xe1, 0x29);
            this.barDockControl3.Size = new Size(0, 0x10d);
            this.imageList.ImageStream = (ImageListStreamer) resources.GetObject("imageList1.ImageStream");
            this.imageList.TransparentColor = Color.Transparent;
            //this.imageList.Images.SetKeyName(0, "3141.ico");
            //this.imageList.Images.SetKeyName(1, "131.ico");
            this.groupControl1.Controls.Add(this.tlXMXX);
            this.groupControl1.Dock = DockStyle.Fill;
            this.groupControl1.Location = new Point(0, 0x29);
            this.groupControl1.Name = "groupControl1";
            this.groupControl1.Size = new Size(0xe1, 0x10d);
            this.groupControl1.TabIndex = 20;
            this.groupControl1.Text = "项目信息";
            this.tlXMXX.Appearance.FocusedCell.BackColor = Color.FromArgb(0xff, 0xff, 0xc0);
            this.tlXMXX.Appearance.FocusedCell.Options.UseBackColor = true;
            this.tlXMXX.Appearance.FocusedRow.BackColor = Color.Sienna;
            this.tlXMXX.Appearance.FocusedRow.Options.UseBackColor = true;
            this.tlXMXX.Appearance.SelectedRow.BackColor = Color.FromArgb(0x80, 0x40, 0x40);
            this.tlXMXX.Appearance.SelectedRow.Options.UseBackColor = true;
            this.tlXMXX.Columns.AddRange(new TreeListColumn[] { this.colMC });
            this.tlXMXX.DataSource = this.bindingSource1;
            this.tlXMXX.Dock = DockStyle.Fill;
            this.tlXMXX.ImageIndexFieldName = "";
            this.tlXMXX.Location = new Point(2, 0x17);
            this.tlXMXX.Name = "tlXMXX";
            this.tlXMXX.OptionsBehavior.Editable = false;
            this.tlXMXX.OptionsView.ShowColumns = false;
            this.tlXMXX.ParentFieldName = "PID";
            this.tlXMXX.PreviewFieldName = "XMMC";
            this.tlXMXX.RepositoryItems.AddRange(new RepositoryItem[] { this.repositoryItemImageComboBox2 });
            this.tlXMXX.Size = new Size(0xdd, 0xf4);
            this.tlXMXX.TabIndex = 0;
            this.tlXMXX.TreeLineStyle = LineStyle.None;
            this.colMC.FieldName = "XMMC";
            this.colMC.Name = "colMC";
            this.colMC.Visible = true;
            this.colMC.VisibleIndex = 0;
            this.colMC.Width = 0x60;
            this.bindingSource1.PositionChanged += new EventHandler(this.bindingSource1_PositionChanged);
            this.repositoryItemImageComboBox2.AutoHeight = false;
            this.repositoryItemImageComboBox2.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.repositoryItemImageComboBox2.Items.AddRange(new ImageComboBoxItem[] { new ImageComboBoxItem("", "1", 1), new ImageComboBoxItem("", "2", 5), new ImageComboBoxItem("", "3", 11) });
            this.repositoryItemImageComboBox2.Name = "repositoryItemImageComboBox2";
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            base.ClientSize = new Size(0xe1, 0x14c);
            base.Controls.Add(this.groupControl1);
            base.Controls.Add(this.barDockControl2);
            base.Controls.Add(this.barDockControl3);
            base.Controls.Add(this.barDockControl1);
            base.Controls.Add(this.barDockControl);
            base.Name = "FrmDataXD";
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text = "数据下达";
            base.Load += new EventHandler(this.FrmDataXD_Load);
            this.barManager.EndInit();
            ((ISupportInitialize) this.bindingSource).EndInit();
            this.groupControl1.EndInit();
            this.groupControl1.ResumeLayout(false);
            this.tlXMXX.EndInit();
            ((ISupportInitialize) this.bindingSource1).EndInit();
            this.repositoryItemImageComboBox2.EndInit();
            base.ResumeLayout(false);
        }

        private void method()
        {
            IDataAccess access = DBHelp.IniIDA();
            this.dataSet.Merge(access.ExecuteDataSet("select * from XMJBXX", CommandType.Text, "XMJBXX"));
            this.bindingSource1.DataSource = this.dataSet.Tables["XMJBXX"];
            this.tlXMXX.ExpandAll();
        }

        private void method1(TreeListNodes treeListNodes, ref string _str2)
        {
            for (int i = 0; i < treeListNodes.Count; i++)
            {
                TreeListNode node = treeListNodes[i];
                if (node.CheckState == CheckState.Checked)
                {
                    if (!_str2.Equals(string.Empty))
                    {
                        _str2 = _str2 + ",";
                    }
                    _str2 = _str2 + "'" + node["ID"].ToString() + "'";
                }
                this.method1(node.Nodes, ref _str2);
            }
        }

        private void method2(object sender, NodeEventArgs e)
        {
            DevCCHelp.SetCheckedChildNodes(e.Node, e.Node.CheckState);
            DevCCHelp.SetCheckedParentNodes(e.Node, e.Node.CheckState);
        }

        private void method3(object sender, CheckNodeEventArgs e)
        {
            e.State = (e.PrevState == CheckState.Checked) ? CheckState.Unchecked : CheckState.Checked;
        }

        public string XMID
        {
            [CompilerGenerated]
            get
            {
                return this._str;
            }
            [CompilerGenerated]
            set
            {
                this._str = value;
            }
        }

        public string XMName
        {
            [CompilerGenerated]
            get
            {
                return this._str1;
            }
            [CompilerGenerated]
            set
            {
                this._str1 = value;
            }
        }
    }
}

